<template>
	<view>
		<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
			<cu-custom bgColor="bg-gradual-blue" :isBack="true">
				<block slot="content">合同到期预警</block>
			</cu-custom>
			<scrollYBox styleText="height: 90vh;" @scrolltolower="loadMore" @handleRefresher="handleRefresher" :list="list">
				<template>
					<view style="padding-bottom: 50rpx;">
							<view class="flex flex-direction box" v-for="(item,index) in list" :key="index">
								<view class="row flex">
									<view class="item flex flex-direction">
										<view class="label">
											企业名称
										</view>
										<view class="val">
											{{item.mc | emptyStr }}
										</view>
									</view>
									<view class="item flex flex-direction">
										<view class="label">
											类型
										</view>
										<view class="val">
											{{item.type | emptyStr}}
										</view>
									</view>
								</view>
								<view class="row flex">
									<view class="item flex flex-direction">
										<view class="label">
											到期时间
										</view>
										<view class="val">
											{{item.expireddate | emptyStr}}
										</view>
									</view>
								</view>
							</view>
					</view>
				</template>
			</scrollYBox>
			
		
		</scroll-view>
	</view>

</template>

<script>
	import {ACCESS_TOKEN} from '@/common/util/constants.js'
	export default {
		components:{
		 },
		data() {
			return {
				modalName: null,
				list:[],
				listUrl:'/jmreport/show',
				pageNo : 1,
				total: '',
				refresherBool: false,
			}
		},
		methods: {
			handleSearch(){
				this.pageNo = 1
				this.getList()
			},
			handleRefresher(){
				this.refresherBool = true
				setTimeout(()=>{
					this.refresherBool = false
				},1000)
				this.handleSearch()
			},
			loadMore(){
				if(this.total == this.list.length) return this.setMessage('没有更多了')
				this.pageNo++
				this.getList()
			},
			getList(){
				let token = uni.getStorageSync(ACCESS_TOKEN);
				let params ={
					token,
					pageNo: this.pageNo,
					pageSize: 10,
				}
				this.$http.post(this.listUrl,
					{
						apiUrl:'',
						id:'867274224080211968',
						params : JSON.stringify(params)
					}
				).then(res=>{
						if(res.data.success){
							if(this.pageNo==1) this.list = []
							// try{
								let list = res.data.result.dataList.expiredDate.list
								this.list = this.list.concat(list)
								// list.forEach(item=>{
								// 	categories.push(item.mc)
								// 	data1.push( item.expireddate)
								// })
								// this.getServerData(categories,data1);
								
							// }catch(e){
							// 	//TODO handle the exception
							// }
							
						}
				})
			}
		},
		onLoad() {
			this.getList()
		}
	}
</script>

<style lang="scss" scoped>
	page{
	}
	.box{
		background-color: #fff;
		margin: 25rpx;
		border-radius: 8rpx;
		padding: 10rpx;
		.row{
			margin: 10rpx;
		}
	}
	.item{
		width: 50%;
		padding-right: 20rpx;
	}
	.label{
		color: #969696;
	}
	.val{
		color: #353535;
		font-size: 32rpx;
		word-wrap: break-word;
	}
</style>
